package com.un.ebs.core.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import lombok.Getter;

@Getter
public enum TableTypeEnum implements IEnum {

    BusinessObject(0, "业务对象"),
    BusinessObjectSet(1, "复合业务对象"),
    BusinessObjectRelation(2, "业务对象关联表"),
    QueryObject(9, "查询");

    TableTypeEnum(Integer value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    @EnumValue
    private final Integer value;
    private final String desc;

    @Override
    public int getCode() {
        return value;
    }

    public static TableTypeEnum valueOf(int code) {
        switch (code) {
            case 0:
                return TableTypeEnum.BusinessObject;
            case 1:
                return TableTypeEnum.BusinessObjectSet;
            case 2:
                return TableTypeEnum.BusinessObjectRelation;
            default:
                return TableTypeEnum.QueryObject;
        }
    }
}
